package com.example.tass.domain;

import cn.tass.exceptions.TAException;

public class MyGenAsymKeyPairRequest extends MyBaseRequest{
    private int keyType;
    private int rsaModulusLen;
    private int eccCurveId;
    private String encKeyId;
    private String enckeyAccessCode;
    private int encMode;
    private int encPadMode;
    private String encIv;

    public MyGenAsymKeyPairRequest() {
    }

    public int getKeyType() {
        return this.keyType;
    }

    public void setKeyType(int keyType) {
        this.keyType = keyType;
    }

    public int getRsaModulusLen() {
        return this.rsaModulusLen;
    }

    public void setRsaModulusLen(int rsaModulusLen) {
        this.rsaModulusLen = rsaModulusLen;
    }

    public int getEccCurveId() {
        return this.eccCurveId;
    }

    public void setEccCurveId(int eccCurveId) {
        this.eccCurveId = eccCurveId;
    }

    public String getEncKeyId() {
        return this.encKeyId;
    }

    public void setEncKeyId(String encKeyId) {
        this.encKeyId = encKeyId;
    }

    public String getEnckeyAccessCode() {
        return this.enckeyAccessCode;
    }

    public void setEnckeyAccessCode(String enckeyAccessCode) {
        this.enckeyAccessCode = enckeyAccessCode;
    }

    public int getEncMode() {
        return this.encMode;
    }

    public void setEncMode(int encMode) {
        this.encMode = encMode;
    }

    public int getEncPadMode() {
        return this.encPadMode;
    }

    public void setEncPadMode(int encPadMode) {
        this.encPadMode = encPadMode;
    }

    public String getEncIv() {
        return this.encIv;
    }

    public void setEncIv(String encIv) {
        this.encIv = encIv;
    }

    public void validate() throws TAException {
        this.checkPrivkeyType(this.keyType, "keyType", true);
        if (this.keyType == 2 && this.rsaModulusLen != 1024 && this.rsaModulusLen != 1192 && this.rsaModulusLen != 2048 && this.rsaModulusLen != 4096) {
            throw new TAException("rsaModulusLen length is invalid.", new Object[]{""});
        }
    }
}
